import java.util.Random;
import java.util.Scanner;
public class Game {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        //产生随机数
        Random random = new Random();//工具
        int number =random.nextInt(100);
        //只给6次机会
        int times = 6;

            while(times>0) {
                System.out.print("请输入你要猜的数字：");
                int input = scanner.nextInt();
                if(input<number) {
                    times--;
                    System.out.println("猜小了,你的次数还剩"+times);

                } else if(input>number) {
                    times--;
                    System.out.println("猜大了,你的次数还剩"+times);

                } else {
                    System.out.println("恭喜你猜对了");
                    break;
                }
            }
            if(times==0) {
                System.out.println("傻瓜，没机会了，下辈子吧");
            }
    }
}
